//
//  TitleButton.swift
//  swift_wobo
//
//  Created by yuxin on 2018/11/15.
//  Copyright © 2018 wuxiantianli. All rights reserved.
//

import UIKit

class TitleButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.setTitleColor(UIColor.darkText, for: .normal)
        self.titleLabel?.font = UIFont.systemFont(ofSize: 17)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), for: .normal)
        self.setImage(UIImage(named: "navigationbar_arrow_up"), for: .selected)
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = (titleLabel?.frame.size.width)!
    }

}
